import { getStorage } from '@/utils/storage'

/** 获取token */
export function getToken() {
	return getStorage('token') || ''
}

/** 获取用户信息 */
export function getUserInfo() {
	const emptyInfo: Auth.UserInfo = {
		userId: '',
		userName: '',
	}
	const userInfo: Auth.UserInfo = getStorage('userInfo') || emptyInfo

	return userInfo
}

/** 去除用户相关缓存 */
export function clearAuthStorage() {
	uni.removeStorageSync('token')
	uni.removeStorageSync('userInfo')
}
